FUNCTION

text.from_bytes

purestatic function from_bytes(bytes: byte_array, [ignore_errors: boolean]): text

Create a text representation of the given bytes.

By default, an exception is thrown if invalid UTF-8 characters are encountered, however if the optional parameter ignore_errors is provided as true, invalid characters are instead replaced with a placeholder.

Parameters

  • bytes — The byte array to convert to text.
  • ignore_errors — if true, invalid characters are replaced with placeholders; if false, an exception is thrown (defaults to false)

Throws

  • exception — if invalid UTF-8 characters are encountered and ignore_errors is false

Since

0.9.0

© 2026 Chromia